package com.tencent.qf.user.dao;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.tencent.qf.user.dal.OrderDO;
import com.tencent.qf.user.dal.TyOrder;
import com.tencent.qf.user.dto.UnionIdPaymentCount;
import com.tencent.qf.user.dto.request.OrderInfoByPlainOrderIdRequest;
import com.tencent.qf.user.dto.request.UserInfoDTO;
import com.tencent.qf.user.dto.response.AOrderNumInfo;
import com.tencent.qf.user.dto.response.EfficientOrderNumInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@DS("orderdb")
@Mapper
public interface TyOrderDao2 {

    List<OrderDO> selectPayByUnionId(@Param("unionId") String unionId);

    Integer selectPayByUnionIdCount(@Param("unionId") String unionId);

    Long selectPayByUnionIdCountWithCreate(@Param("unionId") String unionId);

    List<OrderDO> selectPayByUnionIds(@Param("userInfoDTOS") List<UserInfoDTO> userInfoDTOS);

    List<UnionIdPaymentCount> selectPayByUnionIdsCount(@Param("userInfoDTOS") List<UserInfoDTO> userInfoDTOS);

    /**
     * 查询特定单品A单数量
     *
     * @param skuId         skuId
     * @param irisUid       irisUid
     * @param startTime     开始时间
     * @param endTime       结束时间
     * @param paymentAmount 实付金额
     * @return 特定单品A单数量
     */
    Integer selectAOrderCountBySkuId(@Param("skuId") String skuId, @Param("irisUid") String irisUid,
                                     @Param("startTime") Long startTime, @Param("endTime") Long endTime,
                                     @Param("paymentAmount") Integer paymentAmount);

    /**
     * 查询特定单品A单数量
     *
     * @param skuIds        skuIds
     * @param irisUid       irisUid
     * @param startTime     开始时间
     * @param endTime       结束时间
     * @param paymentAmount 实付金额
     * @return 全场A单数量
     */
    Integer selectAOrderNumAll(@Param("skuIds") List<String> skuIds, @Param("irisUid") String irisUid,
                               @Param("startTime") Long startTime, @Param("endTime") Long endTime,
                               @Param("paymentAmount") Integer paymentAmount);

    List<TyOrder> getOrderInfos(@Param("uid") String uid, @Param("orderIds") List<String> orderIds);

    List<TyOrder> getOrderInfosByUid(@Param("unionId") String unionId, @Param("uid") String uid, @Param("orderNum") Integer orderNum, @Param("isAll") Boolean isAll);

    List<TyOrder> queryEfficientOrderNumInfo(@Param("uids") List<String> uids, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    List<EfficientOrderNumInfo> queryEfficientSplitOrder(@Param("uids") List<String> irisUids, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    List<AOrderNumInfo> queryAOrderNumAllBatch(@Param("uids") List<String> irisUids, @Param("startTime") Long startTime,
                                               @Param("endTime") Long endTime,  @Param("paymentAmount") Integer paymentAmount);

    List<TyOrder> orderInfosByPlainOrderId(OrderInfoByPlainOrderIdRequest request);
}